package com.zj.leetcode.easy;

/**
 * @program: algorithm
 * @description:
 * 只出现一次的数字
 * 136 single-number
 * @author: Zhang Bo
 * @create: 2022-07-22 17:26:07
 **/
public class SingleNumber{
    public static void main(String[] args) {
        Solution solution = new SingleNumber().new Solution();
    }
    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        /**
         * 异或运算就可以了
         * @param nums
         * @return
         */
        public int singleNumber(int[] nums) {
            int single = 0;
            for (int num : nums) {
                single ^= num;
            }
            return single;
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}